import * as React from 'react'; import { Image, ImageProps } from '@aws-amplify/ui-react'; import { Demo } from '@/components/Demo'; import { ImagePropControls } from './ImagePropControls'; import { useImageProps } from './useImageProps'; import { demoState } from '@/utils/demoState'; const propsToCode = (props) => { return `${props.alt} alert('📸 Say cheese!')} />`; }; const defaultImageProps = { alt: 'Amplify logo', src: '/amplify-logo.svg', objectFit: 'initial', objectPosition: '50% 50%', width: '75%', height: '75%', backgroundColor: 'initial', opacity: '100%', }; export const ImageDemo = () => { const imageProps = useImageProps( (demoState.get(Image.displayName) as ImageProps) || defaultImageProps ); React.useEffect(() => { demoState.set(Image.displayName, imageProps); }, [imageProps]); return ( } > {imageProps.alt} alert('📸 Say cheese!')} /> ); };